﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>后台登录页面</title>
    <style type="text/css">
        #table {
            border: 1px solid #0094ff;
            margin: 0 auto;
        }

            #table th, #table td {
                border: 1px solid #0094ff;
            }
    </style>
</head>
<body>
    <form id="f1">
        <table id="table">
            <tr>
                <th>用户名</th>
                <td>
                    <input type="text" value="admin" name="txtUseName" />
                </td>
            </tr>
            <tr>
                <th>密码</th>
                <td>
                    <input type="password" value="123123" name="txtPwd" />
                </td>
            </tr>
            <tr>
                <th>验证码</th>
                <td>
                    <input type="text" name="vcode" /><a href="javascript:void(0)" onclick="ChangVcode()"><img id="img" src="lkasjflkaslfdjla.Vcode" /></a>
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input type="checkbox" value="isRemember" name="isRemember" />是否记住密码七天
                </td>
            </tr>
            <tr>
                <th></th>
                <td>
                    <input type="button" onclick="Login()" value="登录" />
                    |
                    <input type="reset" />
                </td>
            </tr>
        </table>
    </form>
    <script src="/js/jquery-1.8.3.js"></script>
    <script src="/js/msgBox.js"></script>
    <script type="text/javascript">
        var msgBox;
        $(function () {
            msgBox = new MsgBox();
        })
        function Login() {
            //1.0得到参数
            var params = $("#f1").serialize();
            //2.0通过jq中的ajax发送请求
            $.post("/Login/Login.ashx", params, function (data) {
                //处理登录响应回来的数据
                //判断登录是否成功
                if (data.Statu == 0) {
                    msgBox.showMsgOk(data.Msg, function () {
                        window.location = "/admin/Cate/Index.aspx";
                    });
                }
                else {
                    msgBox.showMsgOk(data.Msg, function () {
                        window.location = window.location;
                    });
                }
            }, "json");
        }
        function ChangVcode() {
            // document.getElementById("img").setAttribute("src", "vcode.Vcode?id=" + Math.random());
            $("#img").attr("src", "vcode.Vcode?id=" + Math.random());
        }
    </script>
</body>
</html>
